﻿using System.Xml;

namespace Sprout.Core.Extensions
{
    public static class XmlDocumentExtension
    {
        /// <summary>
        /// 获取XML节点属性值
        /// </summary>
        /// <param name="node"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetAttributes(this XmlNode node, string name)
        {
            if (node.Attributes == null)
            {
                return "";
            }
            else if (node.Attributes[name] == null)
            {
                return "";
            }
            else
            {
                return node.Attributes[name].InnerText;
            }
        }
    }
}
